package org.dru.clay.util.string;

import java.util.Iterator;

/**
 * StringUtils
 * User: joakimd
 * Date: 2013-07-22
 * Time: 16:01
 */
public final class StringUtils {
    private StringUtils() {
    }

    public static String join(final Iterable<String> source, final CharSequence delimiter) {
        final StringBuilder sb = new StringBuilder();
        final Iterator<String> it = source.iterator();
        if (it.hasNext()) {
            sb.append(it.next());
            while (it.hasNext()) {
                sb.append(delimiter);
                sb.append(it.next());
            }
        }
        return sb.toString();
    }
}
